package com.joelaws.prototype.server.dao;

public class DAOFactory {

	private static UserDAO userDAO;

	private static RatingDAO ratingDAO;

	private static MessagingDAO messagingDAO;

	static {
		reset();
	}

	public synchronized static UserDAO getUserDAO() {
		return userDAO;
	}

	public synchronized static RatingDAO getRatingDAO() {
		return ratingDAO;
	}

	public synchronized static MessagingDAO getMessagingDAO() {
		return messagingDAO;
	}

	public synchronized static void reset() {
		userDAO = new UserDAO();
		ratingDAO = new RatingDAO();
		messagingDAO = new MessagingDAO();
		DataLoader.populateDB("data.csv");
	}

}
